<?php
class collecting_day extends MY_Controller{
    function collecting_day(){
        parent::MY_Controller();
        $this->data['title'] = "Collecting Day";
        $this->load->model('m_collecting_day');
    }
    function index(){
        $this->data['content'] = "collecting_day/v_collecting_day";
        $this->data['subLink'] = "collecting_day/collecting_day_proses";
        $this->data['formTitle'] = "Form Collecting Day";
                
        $this->render($this->data);
    }
    function collecting_day_proses(){
        $idDropzone = $_POST['idDropzone'];
        $jumlah = $_POST['jumlah'];
        $lokasi = $_POST['lokasi'];
        $kegiatan = $_POST['kegiatan'];
        $tanggal = date2mysql($_POST['tanggal']);
        $insert = $this->m_collecting_day->addCollectingDay($kegiatan,$lokasi,$idDropzone,$jumlah,$tanggal);
        if($insert['status'] == TRUE){
            $this->session->set_flashdata("message",1);
        }
        
        redirect("collecting_day/collecting_day_info/$insert[id]");
    }
    function collecting_day_info($id){
        $this->data['content'] = "collecting_day/collectingDayInfo";
        $this->data['linkBack'] = "collecting_day";
        $this->data['CollectingDayList'] = $this->m_collecting_day->detailCollectingDay($id);
        $this->render($this->data);
    }
    function unapprove_collecting_day($id,$bulan,$tahun,$jumlah){
        $update = $this->m_collecting_day->unapproveCollectingDay($id,$bulan,$tahun,$jumlah);
        if($update){
            $this->session->set_flashdata("message",1);
        }else{
            $this->session->set_flashdata("message",1);
        }
        
        redirect("rekap_keuangan_bulanan/index/$bulan/$tahun");
    }
}
?>
